/**
 * 云豆支付页面使用示例
 * 展示如何从其他页面跳转到支付页面
 */

// 示例：从商家详情页面跳转到支付页面
function goToPayFromBizDetail(bizId, payPrice) {
  wx.navigateTo({
    url: `/pages/biz/pay?biz_id=${bizId}&pay_price=${payPrice}`
  })
}

// 示例：从商品购买页面跳转到支付页面
function goToPayFromGoods(goodsId, bizId, payPrice) {
  wx.navigateTo({
    url: `/pages/biz/pay?biz_id=${bizId}&pay_price=${payPrice}&goods_id=${goodsId}`
  })
}

// 示例：从订单页面跳转到支付页面
function goToPayFromOrder(orderId, bizId, payPrice) {
  wx.navigateTo({
    url: `/pages/biz/pay?biz_id=${bizId}&pay_price=${payPrice}&order_id=${orderId}`
  })
}

// 使用示例
Page({
  data: {
    bizId: '123',
    payPrice: 99.99
  },

  // 跳转到支付页面
  onPayTap() {
    const { bizId, payPrice } = this.data
    goToPayFromBizDetail(bizId, payPrice)
  },

  // 带商品信息的支付
  onGoodsPayTap() {
    const { bizId, payPrice } = this.data
    const goodsId = '456'
    goToPayFromGoods(goodsId, bizId, payPrice)
  }
})

module.exports = {
  goToPayFromBizDetail,
  goToPayFromGoods,
  goToPayFromOrder
} 